<!doctype html>
<html>
<head>
  <meta charset='utf-8'>
  <title>Memory leak investigation - Handsontable</title>

  <!--
  Loading Handsontable (full distribution that includes all dependencies)
  -->
  <script data-jsfiddle="common" src="js/numeral.de-de.js"></script>
  <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.css">
  <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/pikaday/pikaday.css">
  <script data-jsfiddle="common" src="../dist/pikaday/pikaday.js"></script>
  <script data-jsfiddle="common" src="../dist/moment/moment.js"></script>
  <script data-jsfiddle="common" src="../dist/zeroclipboard/ZeroClipboard.js"></script>
  <script data-jsfiddle="common" src="../dist/numbro/numbro.js"></script>
  <script data-jsfiddle="common" src="../dist/numbro/languages.js"></script>
  <script data-jsfiddle="common" src="../dist/handsontable.js"></script>

  <!--
  Loading demo dependencies. They are used here only to enhance the examples on this page
  -->
  <link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331">
</head>

<body>


<div class="wrapper">
  <div class="wrapper-row">
    <div id="global-menu-clone">
      <h1><a href="../index.html">Handsontable</a></h1>

    </div>

    <div id="container">
      <div class="columnLayout">

        <div class="rowLayout">
          <div class="descLayout">
            <div class="pad" data-jsfiddle="example1">
              <a name="lazy"></a>

              <h2>Memory leak investigation</h2>

              <p>Click the button below to create and remove HOT instance</p>

              <div id="test"></div>

              <p>
                <button id="goGOT">
                  Test memory leak!
                </button>
              </p>
            </div>
          </div>

          <script>
            var myData = [
                {"car": "Mercedes A 160", "year": 2006, "price": 6999.99},
                {"car": "Citroen C4 Coupe", "year": 2008, "price": 8330},
                {"car": "Audi A4 Avant", "year": 2011, "price": 33900},
                {"car": "Opel Astra", "year": 2004, "price": 7000},
                {"car": "BMW 320i Coupe", "year": 2011, "price": 30500}
              ],
              goGOT = document.getElementById('goGOT');

            Handsontable.Dom.addEvent(goGOT, 'click', function () {
              var test = document.getElementById('test'),
                container = document.createElement('DIV'),
                hot;

              test.appendChild(container);

              hot = new Handsontable(container, {
                data: myData,
                startRows: 7,
                startCols: 4,
                colHeaders: ['Car', 'Year', 'Price ($)', 'Price (€)']
              });
              hot.destroy();
              test.removeChild(container);
            });
          </script>
        </div>

        <div class="footer-text">
        </div>
      </div>

    </div>

  </div>
</div>

<div id="outside-links-wrapper"></div>

</body>
</html>
